NAME = wikaml
DEPS = $(wildcard *.tex)

$(NAME).pdf: $(DEPS) $(NAME).bbl
	pdflatex $(NAME).tex
	-grep -q "rerun" $(NAME).log && pdflatex $(NAME).tex

$(NAME).bbl: main.bib
	if [ -e $(NAME).aux ]; then bibtex $(NAME); fi

clean:
	rm -rf *.pdf *.dvi *.aux *.log *.toc *.lof *.out *.bbl *.blg *.~

bib: $(NAME).bbl

.phony: clean bib

